const executeSql = require('../utils/query.js')
const moment = require('moment')

exports.insertArticle = async (data) => {
  let { title, cover, category_id, tag_ids_str, content } = data
  let sql = `insert into article(title, cover, category_id, tag_ids, content, add_date) 
        values('${title}', '${cover}', ${category_id}, '${tag_ids_str}', '${content}', ${moment().unix()})`
  let result = await executeSql(sql)
  return result
}
